package systemfnomabss


trait ContextualFun[A,B,Self<:ContextualFun[A,B,Self] ] extends Function1[A,B]{
  type BindingType
  type Ctx= StringBindingContext[BindingType]
  val ctx: Ctx
  
  def extendtransformed(str:String, trans:String=>String):Self // = {
   // val ctx2 = ctx + (trans(str), new NameBinding(trans(str)))
   // create(ctx2)
  //}
  def extend(str:String) = extendtransformed(str,hintTransform)
  val hintTransform:(String =>String)
  def create(ctx: Ctx) : Self
  def pickUniqueName(n: String) : String = {
    if (ctx.isNameBound(n)) pickUniqueName(n+"'")
    else (n)
  }
  
}



